package com.thti.mecool.client.command.result.plan;

import com.thti.mecool.client.base.BaseActivity;
import com.thti.mecool.client.base.Cache;
import com.thti.mecool.client.base.HandlerConstant;
import com.thti.mecool.client.command.ICommand;
import com.thti.mecool.client.model.biz.PlanBizImpl;
import com.thti.mecool.client.protocol.plan.AddPlanResult;
import com.thti.mecool.client.service.Protocol;

public class AddPlanCommand implements ICommand{

	@Override
	public void doCommand(Object o) {
		AddPlanResult addPlanResult=(AddPlanResult)o;
		if(addPlanResult.getStatus()==1){
			PlanBizImpl planBizImpl=new PlanBizImpl(Cache.getmContext());
			System.out.println("ahah   key!!!!!!!!!!!!    :   "+addPlanResult.getKey());
			planBizImpl.updateDraftPlanId(addPlanResult.getKey(), addPlanResult.getPlanId());
			BaseActivity.setDataFlag(HandlerConstant.AddPlanCommand);
		}else{
			BaseActivity.setCurrentMesg(addPlanResult.getMsg());
			BaseActivity.setDataFlag(HandlerConstant.CommandFail);
		}
		
	}

	@Override
	public String getCommandID() {
		// TODO Auto-generated method stub
		return Protocol.getAddPlan;
	}

	@Override
	public Class<?> getCommandClass() {
		// TODO Auto-generated method stub
		return AddPlanResult.class;
	}

	
	
}
